package com.Interfaec;

public class Test {
    public static void main(String[] args) {
        Animal cat = new Cat();
        cat.eat();

        Animal dog = new Animal() {
            @Override
            public void eat() {
                System.out.println("狗吃肉");
            }
        };
        dog.eat();
        Animal bear = new Animal() {
            @Override
            public void eat() {
                System.out.println("熊吃蜂蜜");
            }
        };
        AnimalOperate.operate(bear);

        Animal mouse = new Animal() {
            @Override
            public void eat() {
                System.out.println("老鼠吃大米");
            }
        };

        Animal[] arr = {mouse,bear,dog};
        for (int i = 0; i < arr.length; i++) {
            arr[i].eat();
        }
    }
}
